package com.ktmall.controller;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ktmall.pojo.WxUser;
import com.ktmall.service.WxUserService;
import com.ktmall.utils.RespMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.stream.Collectors;
@Api("微信用户相关接口")
@RestController
@RequestMapping("/uni/wxUser/profile")
public class WxUserController {
    @Autowired
    private WxUserService wxUserService;

    private RespMsg msg = null;

    @ApiOperation("修改微信用户信息")
    @PostMapping("/update")
    public RespMsg update(@RequestBody WxUser wxUser) {
        System.out.println(wxUser);
        int rows = wxUserService.updateWxUser(wxUser);
        if (rows > 0) {
            msg = RespMsg.success("修改成功", wxUser);
        } else {
            msg = RespMsg.fail("修改失败");
        }
        return msg;
    }
}
